package com.example.eci_quartz.cloudcc.manager;
import com.example.eci_quartz.cloudcc.impl.*;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

@Service
public class TaskManager {
	SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
	/*
	 * @Description:更新客户信息1
	 * @Author: zxb
	 * @Date: 2021-11-25
	 * @param 每天2点执行:
	 * @return: null
	 **/


	@Scheduled(cron = "0 00 14 * * ?")
	public void update_Account0(){

		System.out.println(df.format(new Date())+"更新客户信息1开始");
		AccountImpl.upsertAccount();
		System.out.println(df.format(new Date())+"更新客户信息1结束");
	}
	 /*
	  * @Description:更新客户信息1
	  * @Author: zxb
	  * @Date: 2021-11-25
	  * @param 每天2点执行:
	  * @return: null
	  **/
		@Scheduled(cron = "0 0 2 * * ?")
		public void update_Account1(){
			System.out.println(df.format(new Date())+"更新客户信息1开始");
			AccountImpl.upsertAccount();
			System.out.println(df.format(new Date())+"更新客户信息1结束");
		}
	/*
	 * @Description:更新客户信息2
	 * @Author: zxb
	 * @Date: 2021-11-25
	 * @param 每天2点30分执行:
	 * @return: null
	 **/
		@Scheduled(cron = "0 30 2 * * ?")
		public void update_Account2(){
			System.out.println(df.format(new Date())+"更新客户信息2开始");
			AccountImpl2.upsertAccount();
			System.out.println(df.format(new Date())+"更新客户信息2结束");
		}
	/*
	 * @Description:更新设备信息1
	 * @Author: zxb
	 * @Date: 2021-11-25
	 * @param 每天3点执行:
	 * @return: null
	 **/
		@Scheduled(cron = "0 0 3 * * ?")
		public void update_Equipment1(){
			System.out.println(df.format(new Date())+"更新设备1开始");
			EquipmentImpl.upsertEquipment();
			System.out.println(df.format(new Date())+"更新设备1结束");
		}
	/*
	 * @Description:更新设备信息2
	 * @Author: zxb
	 * @Date: 2021-11-25
	 * @param 每天3点15分执行:
	 * @return: null
	 **/
		@Scheduled(cron = "0 15 3 * * ?")
		public void update_Equipment2(){
			System.out.println(df.format(new Date())+"更新设备2开始");
			EquipmentImpl2.upsertEquipment();
			System.out.println(df.format(new Date())+"更新设备2结束");
		}
	/*
	 * @Description:更新设备信息3
	 * @Author: zxb
	 * @Date: 2021-11-25
	 * @param 每天3点30分执行:
	 * @return: null
	 **/
		@Scheduled(cron = "0 30 3 * * ?")
		public void update_Equipment3(){
			System.out.println(df.format(new Date())+"更新设备3开始");
			EquipmentImpl3.upsertEquipment();
			System.out.println(df.format(new Date())+"更新设备3结束");
		}
	/*
	 * @Description:更新设备信息4
	 * @Author: zxb
	 * @Date: 2021-11-25
	 * @param 每天3点45执行:
	 * @return: null
	 **/
		@Scheduled(cron = "0 45 3 * * ?")
		public void update_Equipment4(){
			System.out.println(df.format(new Date())+"更新设备4开始");
			EquipmentImpl4.upsertEquipment();
			System.out.println(df.format(new Date())+"更新设备4结束");
		}
	/*
	 * @Description:更新csa信息
	 * @Author: zxb
	 * @Date: 2021-11-25
	 * @param 每天4点执行:
	 * @return: null
	 **/
		@Scheduled(cron = "0 0 4 * * ?")
		public void update_Csa(){
			System.out.println(df.format(new Date())+"更新csa开始");
			CsaImpl.upsertCsa();
			System.out.println(df.format(new Date())+"更新csa结束");
		}
	/*
	 * @Description:更新配件信息
	 * @Author: zxb
	 * @Date: 2021-11-25
	 * @param 每天4点15执行:
	 * @return: null
	 **/
		@Scheduled(cron = "0 15 4 * * ?")
		public void update_Peijian(){
			System.out.println(df.format(new Date())+"更新csa开始");
			PeijianOrderImpl.PeijianOrder();
			System.out.println(df.format(new Date())+"更新csa结束");
		}
	/*
	 * @Description:更新epp1
	 * @Author: zxb
	 * @Date: 2021-11-25
	 * @param 每天4点45执行:
	 * @return: null
	 **/
		@Scheduled(cron = "0 45 4 * * ?")
		public void update_Epp1(){
			System.out.println(df.format(new Date())+"更新epp1开始");
			EppImpl.upsertEpp();
			System.out.println(df.format(new Date())+"更新epp1结束");
		}
	/*
	 * @Description:更新epp2
	 * @Author: zxb
	 * @Date: 2021-11-25
	 * @param 每天5点执行:
	 * @return: null
	 **/
		@Scheduled(cron = "0 0 5 * * ?")
		public void update_Epp2(){
			System.out.println(df.format(new Date())+"更新epp2开始");
			EppImpl2.upsertEpp();
			System.out.println(df.format(new Date())+"更新epp2结束");
		}
	/*
	 * @Description:更新epp3
	 * @Author: zxb
	 * @Date: 2021-11-25
	 * @param 每天5点15分执行:
	 * @return: null
	 **/
		@Scheduled(cron = "0 15 5 * * ?")
		public void update_Epp3(){
			System.out.println(df.format(new Date())+"更新epp3开始");
			EppImpl3.upsertEpp();
			System.out.println(df.format(new Date())+"更新epp3结束");
		}
	/*
	 * @Description:更新pip和psp
	 * @Author: zxb
	 * @Date: 2021-11-25
	 * @param 每天5点30执行:每隔10分钟一次
	 * @return: null
	 **/
		@Scheduled(cron = "0 30 5 * * ?")
		public void update_pippsp1(){
			System.out.println(df.format(new Date())+"更新pip&psp1开始");
			NewPipPspImpl.upsertPipPsp();
			System.out.println(df.format(new Date())+"更新pip&psp1结束");
		}
		@Scheduled(cron = "0 40 5 * * ?")
		public void update_pippsp2(){
			System.out.println(df.format(new Date())+"更新pip&psp2开始");
			NewPipPspImpl2.upsertPipPsp();
			System.out.println(df.format(new Date())+"更新pip&psp2结束");
		}
		@Scheduled(cron = "0 50 5 * * ?")
		public void update_pippsp3(){
			System.out.println(df.format(new Date())+"更新pip&psp3开始");
			NewPipPspImpl3.upsertPipPsp();
			System.out.println(df.format(new Date())+"更新pip&psp3结束");
		}
		@Scheduled(cron = "0 0 6 * * ?")
		public void update_pippsp4(){
			System.out.println(df.format(new Date())+"更新pip&psp4开始");
			NewPipPspImpl4.upsertPipPsp();
			System.out.println(df.format(new Date())+"更新pip&psp4结束");
		}
		@Scheduled(cron = "0 10 6 * * ?")
		public void update_pippsp5(){
			System.out.println(df.format(new Date())+"更新pip&psp5开始");
			PipPspImpl5.upsertPipPsp();
			System.out.println(df.format(new Date())+"更新pip&psp5结束");
		}
		@Scheduled(cron = "0 20 6 * * ?")
		public void update_pippsp6(){
			System.out.println(df.format(new Date())+"更新pip&psp6开始");
			PipPspImpl6.upsertPipPsp();
			System.out.println(df.format(new Date())+"更新pip&psp6结束");
		}
		@Scheduled(cron = "0 30 6 * * ?")
		public void update_pippsp7(){
			System.out.println(df.format(new Date())+"更新pip&psp7开始");
			PipPspImpl7.upsertPipPsp();
			System.out.println(df.format(new Date())+"更新pip&psp7结束");
		}
		@Scheduled(cron = "0 40 6 * * ?")
		public void update_pippsp8(){
			System.out.println(df.format(new Date())+"更新pip&psp8开始");
			PipPspImpl8.upsertPipPsp();
			System.out.println(df.format(new Date())+"更新pip&psp8结束");
		}
		@Scheduled(cron = "0 50 6 * * ?")
		public void update_pippsp9(){
			System.out.println(df.format(new Date())+"更新pip&psp9开始");
			PipPspImpl9.upsertPipPsp();
			System.out.println(df.format(new Date())+"更新pip&psp9结束");

		}

}
